<template>
	<div class="consult w944">
		<alert ref="alert"></alert>
		<div class="label_top">
			<p><i class="line"></i>活动讲座</p>
		</div>
		<div class="label_table">
			<div class="el-tabs-report">
				<a class="listOne" @click="goaddconsult">推荐活动讲座</a>
				<a class="listTwo" @click="importDaoChu">导出数据</a>
			</div>
			<el-table ref="multipleTable" :data="tableData" border>
				<el-table-column prop="title" label="活动讲座标题"></el-table-column>
				<el-table-column label="活动时间">
					<template slot-scope="scope">{{scope.row.starttime}} - {{scope.row.endtime}}</template>
				</el-table-column>
				<el-table-column label="操作" width="100">
					<template slot-scope="scope">
						<el-button @click="cancelTuijian(scope.row)" class="red">取消推荐</el-button>
					</template>
				</el-table-column>
			</el-table>
		</div>
	</div>
</template>
<script>
	import alert from '../../components/Alert.vue';
	export default {
		data() {
			return {
				lectureRecommend:'',
				tableData:[]
			}
		},
		methods: {
			getTableList(){
				this.$ajax({
					url: this.$root.jifuUrl + "/getRecommendActivityLectureList?"+'rootcompanyid='+1,
					method: 'GET',
					data: {},
					success: res => {
						if(res.data.code == 200) {
							this.tableData = res.data.data;
							this.total=res.data.data.pageParam.items;
						}
					}
				});
			},
			cancelTuijian(row) {
				let s={id:row.id};
				this.$ajax({ 
					url: this.$root.jifuUrl + "/updateRecommendActivityLecture",
					method: 'POST',
					data:this.qs.stringify(s),
					success: res => {
						if(res.data.code == 200) {
							this.$rootFunction().cancelTuijianResSuccess();
						}else{
							this.failText = res.data.message;
							this.$rootFunction().deleteResFail();
						}
					}
				});
			},
			goaddconsult() {
				this.$router.push({
					name: 'lecture',
					params: {
						type: 'addTj'
					}
				});
			},
			importDaoChu(){}
		},
		components: {
			alert
		},
		mounted: function() {
			this.getTableList();
			this.lectureRecommend = this.$root.huasan.lectureRecommend;
		}
	}
</script>